package it.hopeless.jee6.conversation;

import javax.inject.Inject;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;


public abstract class LetterCollector implements Collector {


    public List<Character> letters = new ArrayList<Character>();


    private String sortedTExt = "";

    public abstract void setText(String text);

    public abstract String getText();
    public abstract String getAddedText();

    public void sort() {
        Collections.sort(letters);
        StringBuffer buffer = new StringBuffer();
        for (char c : letters) {
            buffer.append(c);
        }

        sortedTExt = buffer.toString();
    }

    public String getSortedText() {
        return sortedTExt;
    }

    public String getLettersText(){
        StringBuffer buffer = new StringBuffer();
        for(char c  : letters){
            buffer.append(c);
        }
        return buffer.toString();
    }
}
